package com.tea.tea_vue.Controller;


import com.fasterxml.jackson.core.JsonProcessingException;
import com.tea.tea_vue.Mapper.UsersMapper;
import com.tea.tea_vue.Service.UserService;
import org.springframework.boot.configurationprocessor.json.JSONException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
@RequestMapping("/users")
@CrossOrigin(value = "*")
public class UserController {
    @Resource
    private UserService userService;
    @Resource
    private UsersMapper usersMapper;

    @GetMapping("/listAll/{pageNum}/{pageSize}")
    @ResponseBody
    public String userPage(@PathVariable("pageNum") Integer pageNum,
                           @PathVariable("pageSize") Integer pageSize) throws JSONException, JsonProcessingException {
        String userList = userService.getUserList(pageNum, pageSize);
        System.out.println(userList);
        return userList;
    }
}
